package com.sqk.template.log;

import com.baidu.disconf.client.config.DisClientConfig;
import com.sqk.framework.log.AbstractAspect;
import com.sqk.framework.log.InputData;
import com.sqk.framework.log.LogTypeEnum;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author Cindy.Zhu
 * @date 2022/5/13
 * @Desc：
 */
@Aspect
@Component
public class TemplateServerLogAspect extends AbstractAspect {
    @Override
    @Pointcut("execution(* com.sqk.*.service..*Service.*(..))")
    public void point() {

    }

    @Override
    @Around("point()")
    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
        InputData req = new InputData();
        req.setProject(DisClientConfig.getInstance().APP);
        return doAroundService(pjp, req);
    }

    @Override
    public String fetchType() {
        return LogTypeEnum.RPC.getValue();
    }
}
